<?php

include '../source/config.php';
include '../source/soap.fnc.php';
include '../source/mysql.cls.php';

$soap = start_soap($wsdl_url['MTS']);

$data = $arr = array();
$list = $row = array();



	
if(!empty($phone_code)){
	
	//$arr['err'] = 1;
	//$arr['errinfo'] = $type;

	$data['mobile'] = $phone_code;
	$result = $soap->checkMobile($data);
	
	
	
	//

	if(!empty($result)){
			
		$uuid= $list['uuid'] = $result->isChecked;
		$arr=array('uuid'=>$uuid,'mobile'=>$phone_code);
		//写入数据库预占号码 生成订单ID

		
		$db = new db_mysql();
		$db->connect($dbhost, $dbuser, $dbpw, $dbname);

		$sqlarr = array('uuid'=>$uuid,'mobile'=>$phone_code,'create_time'=> date("Y-m-d H:i:s"),'startCost'=>$startCost,'minConsumption'=>$minConsumption,'lowestFee'=>$lowestFee);
		$db->do_insert('checkMobile',$sqlarr);
		//writelog('uuid',$arr);
		//
		//$list[] = $row;
		
	}

}
	echo json_encode($arr);

?>